/*
 * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
主要功能：
1. 继承自 NoteWidgetProvider，定义 2x2 大小便签小部件的行为与样式
2. 重写 onUpdate 方法，调用父类 update 完成内容更新
3. 提供 2x2 小部件对应的布局文件（widget_2x.xml）
4. 提供根据背景颜色ID获取 2x2 小部件对应背景资源的方法
5. 返回该小部件的类型标识（TYPE_WIDGET_2X），用于识别不同类型的便签小部件
*/

//声明类所在的包名
package net.micode.notes.widget;

//导入依赖
import android.appwidget.AppWidgetManager;
import android.content.Context;

import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.tool.ResourceParser;


public class NoteWidgetProvider_2x extends NoteWidgetProvider {
    @Override
    //调用父类的update方法，更新小部件的显示内容。
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        super.update(context, appWidgetManager, appWidgetIds);
    }

    @Override
    //重写父类的方法,返回2x2小部件的布局文件ID
    protected int getLayoutId() {
        //2x2大小便签小部件的布局文件
        return R.layout.widget_2x;
    }

    @Override
    //根据便签的背景颜色ID，返回对应的2x2小部件背景资源ID
    protected int getBgResourceId(int bgId) {
        return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
    }

    @Override
    //返回2x2大小便签小部件的类型标识
    protected int getWidgetType() {
        return Notes.TYPE_WIDGET_2X;
    }
}
